package com.huangwei.controller;

import com.huangwei.service.CarBandService;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;
import java.util.LinkedList;
import java.util.List;

@RestController
@RequestMapping("carBands")
public class CarBandsController {
    @Resource
    CarBandService carBandService;
    @GetMapping("/getBands")
    public List getCarBands() {
        List carBandsList = new LinkedList<>();
        carBandsList.add("全部");
        carBandService.getAllCarBands().stream()
                .forEach(carBands -> carBandsList.add(carBands.getCarBandName()));
        return carBandsList;
    }
}
